1. Field of the Invention
The present invention relates to an information processing apparatus to which an arbitrary function can be added, and to a method therefor.
2. Related Background Art
For conventional camera systems, the relationship between the purpose for which memory is employed and addresses is ordinarily determined when compiling and linking is performed, and memory managers are therefore not mounted. When a camera system on which is mounted a memory manager for dynamically allocating memory is compared with a conventional camera system, it is found that the camera system on which the memory manager is mounted has included certain features that are described below.
Whereas when no memory manager is mounted memory that is to be used for an additional program must be reserved in advance because the version of a program stored in the ROM in a camera and the location of the memory depend greatly on each other and a small reserved area for an additional program must be set aside to ensure compatibility; when a memory manager is employed, in order for the memory to be fully utilized, the maximum memory area to be used at any one time need only be so set that it does not exceed the physical memory capacity. Memory management methods for a system having no virtual storage include a method for using a bit map and a method for using a variable length memory that is divided into memory management blocks. Since for the method involving the use of a bit map time must be allocated for searching for free memory having a required size, this method is infrequently employed for actual computer systems. As for the method for dividing a memory having a variable length, there are three well known methods: the Best Fit method, the First Fit method and the Next Fit method. Although the feature of the Best Fit method is that large continuous areas are constantly ensured, the allocation speed is reduced in proportion to the number of memory blocks. This property is shared by the First Fit method. Although according to the Next Fit method fast allocation can be performed regardless of the number of blocks, the fragmentation of free memory can occur. In image processing using a digital camera, since an image for one screen is divided into one thousand blocks, low allocation speed has a fatal effect on the processing speed of a camera. In addition, unlike a camera that uses conventional film, a digital camera that employs a hard disk having a large capacity and an alternating current (xe2x80x9cACxe2x80x9d) power source is capable of taking several tens of thousands of sequential shots, so that a failure of allocation due to fragmentation of memory is not allowed. The allocation of memory performed by the Next Fit method and the fragmentation of memory will be further explained. In (1) of FIG. 2 is shown the initial state of a Next Fit memory manager. The main memory is managed as one free memory block, and an allocation pointer is set at the head. The block includes the information types shown in FIG. 4: the size of a block, a flag indicating whether the block is free memory or whether it is in use, and a user application portion. When the entire memory is to be allocated while employing a 4-byte alignment, the block size need only be a multiple of four, and the remaining least significant bit can be used as a use flag. The block size can be employed to ascertain the head position of a succeeding block. The portion wherein information, such as the block size and the use flag, is stored is called an MCB (memory control block).
In (2) of FIG. 2 is shown the status when memory block A is requested by an application and is allocated. The memory is divided into one free block and one used memory block, while the allocation pointer is set so that it points to the head of the free memory division. In (3) of FIG. 2 is shown the status when memory block B is requested by the application and is allocated. The free memory is further divided for memory block B, and the main memory is, therefore, broken into three blocks. In (4) of FIG. 2, memory block A is no longer required and is released. Although the portion allocated to memory block A is now a free block, the position of the allocation pointer is not updated. When memory block C is requested in (5) of FIG. 2, the position that was previously occupied by memory block A is not employed. When the memory size that is requested is larger than the free memory pointed to by the allocation pointer, a search for free memory is begun at the position of the allocation pointer. When a free memory block that is larger than the requested size is found, that memory block is divided and allocated. The allocation and the release of memory are repeated in the above described manner until a state such as is shown in (6) of FIG. 2 results. The status shown in (6) of FIG. 2 requests an allocation failure that occurred because the maximum size of each of the continuous memory blocks was smaller than the size of the area requested for memory B, even though the amount of free memory available was greater than that required for memory B. As a result, it is difficult to employ the Next Fit method for an application where the allocation and the release of memory are endlessly repeated.
A memory manager according to the present invention defines a function that considerably reduces the effect of the above described problem, and enables an application to employ the function so that the memory can be utilized, for example, in a digital camera field. When memory is reallocated after fragmentation has occurred, the maximum continuous area size is increased. However, when the reallocation of memory is performed while the system is in use, much of the time a central processing unit (xe2x80x9cCPUxe2x80x9d) is in operation will be spent in transferring memory. To avoid the fragmentation of memory when building a camera system, a means for restarting the system whenever a predetermined period of time has elapsed can be employed. As was previously described above, however, continuous operation is a very important specification for a digital camera. Even when such technique of restarting of the camera is not used, there is a time in a system when the amount of memory used is extremely small, and the system can utilize that time. If an extreme reduction of the amount of memory used is always initiated in consonance with a specific timing, the allocation pointer will be moved to the head of the main memory in consonance with that timing, so that a condition that most closely resembles the restarting of the memory manager can be provided. While the technical development cycle for personal computers is short, new image formats appear regularly, the internal structure of the digital camera is being computerized, and the processing range within which software is used is also being extended. Therefore, as with the personal computer, software is being added to the digital camera to expand its operation, so that the investment in hardware development is limited and the digital camera system can catch up with the rapid technical development cycle. The software for a digital camera, however, varies and includes software prepared for communication and for file systems, and it is difficult to predict which functions will be significant in the future and which techniques will commonly be applied. Since various lots of digital cameras are sold on the market, additional extension software must be so designed that it can coexist with internally incorporated software of any lot. The present invention relates to a technique whereby an arbitrary function for a digital camera can be replaced and extended by software that is added later.
According to one embodiment of the present invention, provided is an information processing apparatus that has a function for managing memory using the Next Fit method and for reducing a problem associated with the fragmentation of memory.
The other purposes and features of the present invention will become apparent while referring to the following specification and drawings.